<?php 
	session_start();
	require_once("../includes/public.inc.php");
	$act = isset($_GET['act'])?$_GET['act']:'';
	$type = isset($_GET['type'])?$_GET['type']:'';
	$username = isset($_SESSION['username'])?$_SESSION['username']:'';
	if ($act=='list')
	{
		$key = isset($_POST['key'])?$_POST['key']:'';
		if ($key)
		{
			$pr = mysql_query("select * from ".DBQIAN."gift where name like '%".trim($key)."%'");
			//select * from yifenduohao_product where name like '%香%'
		}
		else 
		{
			echo "<script>alert('查询条件为空');history.go(-1);return false;</script>";	
		}
	}
	else 
	{
		$pr = mysql_query("select * from ".DBQIAN."gift ");	
	}
	//print_r($ar);exit;
?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="user-scalable=yes, width=device-width, initial-scale=1.0, maximum-scale=1.0">
<title>积分商城</title>
<link rel="stylesheet" type="text/css" href="css/lipin.css" media="all">
</head>
<body>
	<div class="pz-css">
		<ul class="top-tool">
			<li class="title">
			<div style="margin: 0px 50px;">
			<form action="creditshop.php?act=list&type=<?=$_GET['type']?>" method="post">
				<div class="inputs" style="width: 100%; margin: auto;">
					<input value="<?=isset($_POST['key'])?$_POST['key']:''?>" style="width: 50%;" name="key" placeholder="输入查找产品" type="text">
					<input class="gray" type="submit" value="查询" style="background: url('qry.png') no-repeat scroll center center transparent; width: 20%;">
				</div>
			</form>
			</div>
			</li>
			<li class="back"><a href="javascript:history.go(-1)"></a>
			</li><li class="home"><a href="index.php?type=<?=$type?>"></a></li>
		</ul>
		<div class="list" style="padding: 5px;">
	      	 <? while($row = mysql_fetch_assoc($pr)){?>
				<a href="creditshop_detail.php?&&id=<?=$row['id']?>&type=<?=$_GET['type']?>" class="item">
					<img src="<?=$row['img']?>" />
					<p>
						<span><?=$row['name']?></span><br/>
					</p>
				</a>
	     	<?}?> 
		</div>
		<div class="span12"><button onclick="location.href='index.php?type=<?=$_GET['type']?>'">返回</button></div>
	</div>		
</body>
</html>